package com.example.tsbs.util;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

/**
 * 配置文件读取
 */
public class PropertyUtil {

    /**
     * 读取模型路径地址
     */
    public static String getModelPath() {
        Properties properties = new Properties();
        String model_path = null;
        try {
            InputStream inputStream = new BufferedInputStream(new FileInputStream(new File("config/path.properties")));
            properties.load(inputStream);
            model_path = properties.getProperty("model_path");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return model_path;
    }

    /**
     * 读取材料路径地址
     */
    public static String getMaterialPath() {
        Properties properties = new Properties();
        String path = null;
        try {
            InputStream inputStream = new BufferedInputStream(new FileInputStream(new File("config/path.properties")));
            properties.load(inputStream);
            path = properties.getProperty("material_path");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return path;
    }

    /**
     * 读取仿真结果路径地址
     */
    public static String getResultPath() {
        Properties properties = new Properties();
        String path = null;
        try {
            InputStream inputStream = new BufferedInputStream(new FileInputStream(new File("config/path.properties")));
            properties.load(inputStream);
            path = properties.getProperty("result_path");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return path;
    }

}
